﻿
enum ComparisonResult
{
    OrderedAscending = -1,
    OrderedSame,
    OrderedDescending
};

class TextPosition
{
    line: number;
    character: number;
    constructor(line: number, character: number)
    {
        this.character = character;
        this.line = line;
    }

    compare(p: TextPosition): ComparisonResult
    {
        if (this.line < p.line)
            return ComparisonResult.OrderedAscending;
        if (this.line > p.line)
            return ComparisonResult.OrderedDescending;
        else
        {
            if (this.character < p.character)
                return ComparisonResult.OrderedAscending;
            if (this.character > p.character)
                return ComparisonResult.OrderedDescending;
            return ComparisonResult.OrderedSame;
        }
    }
}